package com.qqt.csr.message.event.intrasite.workorder;

import com.qqt.csr.common.session.SessionContextHolder;
import com.qqt.csr.message.assembler.MessageNotifyAssembler;
import com.qqt.csr.message.entity.MessageNotify;
import com.qqt.csr.message.event.intrasite.IntraSiteMessageEvent;

import java.util.List;

/**
 * @Author: yang hao
 * @Date: 2024/12/11 10:56
 * @Description: 工单站内消息事件
 **/
public class WorkOrderIntraSiteMessageEvent extends IntraSiteMessageEvent<WorkOrderEventSource> {

    /**
     * Create a new {@code WorkOrderIntraSiteMessageEvent}.
     * @param source {@link WorkOrderEventSource} 消息来源
     */
    public WorkOrderIntraSiteMessageEvent(WorkOrderEventSource source) {
        super(source);
    }

    /**
     * 消息实体
     * @return {@link List<WorkOrderEventSource>} 消息实体集
     */
    @Override
    public List<MessageNotify> message() {
        WorkOrderEventSource source = this.getSource();
        Long currentUserId = SessionContextHolder.getHeaderInfo().getUserId();
        return MessageNotifyAssembler.convert(source, currentUserId, getNotifyType());
    }
}
